package progress.exa28_1.part4;


/**
 * 自己使用ThreadPoolExecutor类自定义线程池
 */
public class ThreadPoolTest {
    public static void main(String[] args) throws InterruptedException {

        new Thread(()->{
            while (true){
                ThreadPoolExecutorStudy.showStatisticsInfo();
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        }).start();

        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('a',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('b',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('c',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('d',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('e',5));
        Thread.sleep(5000);
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('f',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('g',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('h',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('f',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('g',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('h',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('f',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('g',5));
        ThreadPoolExecutorStudy.POOL.execute(new ThreadPoolStudy.PrintChar('h',5));

    }
}
